package edu.bit.water.controller;

import edu.bit.water.entity.ManagementIndicator;
import edu.bit.water.entity.MetaTI;
import edu.bit.water.entity.TechnicalIndicator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.*;

import edu.bit.water.entity.MetaTI;
import edu.bit.water.service.MetaTIService;


/**
 * 这里对应数据库中Meta_assessment_indicator表的controller
 * 对应企业管理指标
 * @Author： Page
 */
@Controller
@RequestMapping("/meta_technical_indicator")
public class MetaTIController {

    @Autowired
    private MetaTIService MetaTIService = new MetaTIService();

    @ResponseBody
    @RequestMapping(value = "/select", method=RequestMethod.GET)
    public Map<String, Object>selectMetaTI(String stNumber) {
        Map<String, Object> result = new HashMap<>();
        List<MetaTI> list = MetaTIService.selectMetaTI(stNumber);
        result.put("rows", list);
        return result;
    }
    @ResponseBody
    @RequestMapping(value = "/select_note", method=RequestMethod.GET)
    public Map<String, Object>selectMetaTINote(String stNumber) {
        Map<String, Object> result = new HashMap<>();
        List<MetaTI> list = MetaTIService.selectMetaTINote(stNumber);
        result.put("rows", list);
        return result;
    }
    @ResponseBody
    @RequestMapping("/insert")
    public Map<String, Object> insertMetaTI(MetaTI metaTI) {
        //metaTI.showContent();
        return MetaTIService.insertMetaTI(metaTI);
    }
    @ResponseBody
    @RequestMapping("/insert_note")
    public Map<String, Object> insertMetaTINote(MetaTI metaTI) {
        return MetaTIService.insertMetaTINote(metaTI);
    }

    /**
     * 删除metaStandard
     * author Page
     */
    @ResponseBody
    @RequestMapping("/delete")
    public Map<String, Object> deleteMetaTI(@RequestBody List<String>MetaTIs) {
        return MetaTIService.deleteMetaTI(MetaTIs);
    }
    @ResponseBody
    @RequestMapping("/delete_note")
    public Map<String, Object> deleteMetaTINote(@RequestBody List<String>metaTIs) {
        return MetaTIService.deleteMetaTINote(metaTIs);
    }
    @ResponseBody
    @RequestMapping("/update_note")
    public Map<String, Object> updateMetaStandardNote(MetaTI metaTI) {
        Map<String, Object> result = MetaTIService.updateMetaTINote(metaTI);
        return result;
    }
    /**
     * 级联删除technical_indicator_table
     * author Page
     */
    @ResponseBody
    @RequestMapping("/technical_delete")
    public Map<String, Object> technicalDelete(@RequestBody List<String> assessmentContent) {
        return MetaTIService.technicalDelete(assessmentContent);
    }

    @ResponseBody
    @RequestMapping("/update")
    public Map<String, Object> updateMetaStandard(MetaTI metaTI) {
        Map<String, Object> result = MetaTIService.updateMetaTI(metaTI);
        return result;
    }

    /**
     * 级联编辑technical_indicator_table
     * author Page
     */
    @ResponseBody
    @RequestMapping("/technical_update")
    public Map<String, Object> technicalUpdate(TechnicalIndicator tempData) {
        return MetaTIService.technicalUpdate(tempData);
    }
}